package com.etms.controller;

import com.etms.pojo.SysUser;
import com.etms.service.AttendService;
import com.etms.vo.AttendParmas;
import com.etms.vo.PageParmas;
import com.etms.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("attend")
public class AttendController {
    @Autowired
    AttendService attendService;

    @GetMapping("start")
    public Result qiandao(HttpSession session){
        SysUser user = (SysUser) session.getAttribute("user");
        //签到
        return attendService.qiandao(user.getId());
    }

//    @GetMapping("end")
//    public Result qiantui(HttpSession session){
//        SysUser user = (SysUser) session.getAttribute("user");
//        //签到
//        return attendService.qiantui(user.getId());
//    }
    @PostMapping("getList")
    public Result getList(@RequestBody PageParmas pageParmas){
        return attendService.getList(pageParmas);
    }

    @GetMapping("getPaihang")
    public Result getPaihang(){
        return attendService.getPaihang();
    }
    @PostMapping("Update")
    public Result Update(@RequestBody AttendParmas attendParmas){
        return attendService.updateSarely(attendParmas);
    }

}
